from django.http import HttpResponse
from django.http import JsonResponse
from django.shortcuts import render

from Model.ocorder import OcOrder


def hello(request):
    return HttpResponse("Hello world ! ")


def get_order_list(request):
    list1 = ['physics', 'chemistry', 1997, 2000]
    response = JsonResponse({"foo": "bar"})
    res = HttpResponse()
    res.content = response
    return res


def runoob(request):
    context = [{"code": "CDF"}, {"code": "JCF"}, {"code": "BKF"}]
    return render(request, 'runoob.html', {"list": context})


def get_all_order(request):
    result = OcOrder.objects.all()[0:10]
    #print(f'---------{result[0].OrderNumber}-----')
    return render(request, 'runoob.html', {"list": result})
